package com.forenow.demo.demo16.oop;

/**
 * 构造器的重载（overload）:在调用构造器的时候根据参数决定调用哪个构造器
 *
 *
 */
public class OverloadDemo {
    //构造器的重载
    public OverloadDemo(){
        System.out.println("11111");
    }
    public OverloadDemo(int a){
        System.out.println(a);
    }
    public OverloadDemo(String a){
        System.out.println(a);
    }
    //方法重载
    public int add(int a,int b){
        return a+b;
    }
    public int add(int a,int b,int c){
        return a+b+c;
    }
    public static void main(String[] args) {
        OverloadDemo overloadDemo= new OverloadDemo("abc");

    }
}
